/**
 *
 */
package com.angel.mocks.data.generator.dataGenerator;

import java.io.FileNotFoundException;
import java.io.InputStream;

import com.angel.data.generator.annotations.Generator;
import com.angel.data.generator.annotations.importFileProcessorRunner.ImportFileProcessorRunnerBuilder;
import com.angel.data.generator.annotations.inputStream.InputStreamBuilder;
import com.angel.data.generator.exceptions.DataGeneratorException;
import com.angel.io.descriptor.FileProcessorDescriptor;
import com.angel.io.processors.commands.impl.ExcelFileProcessorCommand;
import com.angel.io.processors.runners.imports.impl.ImportFileAnnotationProcessorRunner;
import com.angel.io.processors.runners.imports.impl.ImportFileProcessorRunner;
import com.angel.mocks.data.generator.domainObject.Municipalidad;
import com.angel.mocks.data.generator.rowProcessorCommand.MunicipalidadAnnotationRowProcessorCommand;
import com.angel.mocks.io.resourceLocation.ResourceLocation;

/**
 * @author Guillermo Salazar
 * @since 27/Agosto/2009
 *
 */
@Generator(
		objectClass = Municipalidad.class,
		dependencies = {},
		daoName = "municipalidadDAO",
		pages = {}
)
public class MunicipalidadAnnotationDataGenerator {

	@ImportFileProcessorRunnerBuilder(fileProcessorDescriptor = FileProcessorDescriptor.class, name = "Importacion Municipalidades")
    public ImportFileProcessorRunner prepareImportFileProcessorRunner(FileProcessorDescriptor fileProcessorDescriptor) {
        return new ImportFileAnnotationProcessorRunner(fileProcessorDescriptor, new ExcelFileProcessorCommand(), new MunicipalidadAnnotationRowProcessorCommand());
    }

    @InputStreamBuilder
    public InputStream prepareInputStream() {
        try {
            return ResourceLocation.findInputStreamFor(ResourceLocation.MUNICIPALIDADES_EXCEL_FILE);
        } catch (FileNotFoundException e) {
            throw new DataGeneratorException("File not found [" + ResourceLocation.MUNICIPALIDADES_EXCEL_FILE + "].", e);
        }
    }

}
